﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DbLibrary.Abstracts;
using DbLibrary.DataBase;
using ReportPeriod = DbLibrary.Models.ReportPeriod;


namespace DbLibrary.Helpers
{
    public class ReportPeriodCreateHelper : SingletonBase<ReportPeriodCreateHelper>
    {
        private ReportPeriodCreateHelper() {}

        public Int32 CreatePeriod(ReportPeriod report)
        {
            var rep = new ReportPeriodRepository();
            if (rep.GetAll().Count(_ => _.Name == report.Name) == 0)
                rep.Save(report);

            return report.Id;
        }
    }
}
